package hw04.grammar.productions;

import java.util.Collection;
import java.util.LinkedList;
import java.util.List;

import hw04.Answers;
import hw04.grammar.Executable;

public class Rule implements Executable {
	
	private IDB head;
	private Subgoals subgoals;
	
	public Rule(IDB head, Subgoals subgoals) {
		setHead(head);
		setSubgoals(subgoals);
	}

	public IDB getHead() {
		return head;
	}

	public void setHead(IDB head) {
		this.head = head;
	}

	public Subgoals getSubgoals() {
		return subgoals;
	}

	public void setSubgoals(Subgoals subgoals) {
		this.subgoals = subgoals;
	}

	@Override
	public String toString() {
		return getClass().getSimpleName() + ":" + getHead().toString() + " :- " + getSubgoals().toString();
	}

	@Override
	public void execute() {
		Answers.addRule(this);		
	}
	
}
